In general, you will go through several steps before you can get an output from your program; 1) First you will use an editor to type your program, 2) then you will use a compiler (in our case a C++ compiler) to compile your program and to get an executable file, and 3) at last, you will run the executable file to obtain the output.
The most important part of a programmer's job is solving the problem first. It is much harder to solve a problem than to translate your ideas to a specific programming language. Thus, one should first think about a method and develop an algorithm to solve the problem. An algorithm is a sequence of precise instructions, which results in a solution. The keyword here is precision. If your algorithm has ambiguity in it, then you will not get the correct answer.
Exercise 1.1
Suppose you are helping the university registrar office with the registration
process. You are to send students to six different halls depending on the
first letter of their last names and the balance that has appeared on their
bills. Here are the criteria you will use to separate them:
Students with balance zero, Letters:
A-E in Hall 3, F-J in Hall 2, L-O in Hall 8, P-R in Hall 10, and S-Z
in Hall 12.
Students with a non-zero balance go to Hall 18. These students can go back to register once they have a zero balance on their bills.
Write (or draw a diagram) to show the steps that your algorithm will
take to solve this problem. Here are a few hints: hint1,
hint2,
and hint3.